from rest_framework.viewsets import ModelViewSet
from apps.meiduo_admin.utils import PageNum
from apps.meiduo_admin.serializers.admin import AdminUserSerializer
from apps.users.models import User
from rest_framework.generics import ListAPIView
from django.contrib.auth.models import Group
from apps.meiduo_admin.serializers.group import GroupSerialzier


class AdminModelViewSet(ModelViewSet):
    # 设置is_staff = True
    queryset = User.objects.filter(is_staff=True)
    # 设置序列化器
    serializer_class = AdminUserSerializer

    pagination_class = PageNum


# 获取所有组的数据
class SimpleGroupListAPIView(ListAPIView):
    queryset = Group.objects.all()

    serializer_class = GroupSerialzier
